package com.example.my;

import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;

import com.example.my.util.MyApplication;

/**
 * 内存泄露演示类
 */
public class LeakActivity extends AppCompatActivity {
    private Handler mHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
        }
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_leak);
        mHandler.sendEmptyMessageDelayed(0, 24 * 60 * 60);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
//        if (mHandler.hasMessages(0)) {
//            mHandler.removeMessages(0);
//        }
        MyApplication.getRefWatcher().watch(this);
    }
}
